<?php
include('groups.php');
include('selectMonth.php');
include('selectYear.php');
?>

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Index</title>
    </head>
    <body>
        <a href="expense.php">Add new expense</a>
        <form style="display: inline" method="post" action="index.php">
            <select name="month">
                <?php
                 foreach($months as $key=>$value)
                 {
                    echo '<option value="'.$key.'">'.$value.'</option>';
                 }
                ?>
            </select>
            <select name="year">
                <?php
                 foreach($years as $value)
                 {
                    echo '<option value="'.$value.'">'.$value.'</option>';
                 }
                ?>
            </select>
            <select name="filter">
                <?php
                 foreach($groups as $key=>$value)
                 {
                    echo '<option value="'.$key.'">'.$value.'</option>';
                 }
                ?>
            </select>
            <input type="submit" value="Filter"/>      
        </form>
        <table border="1">
            <tr>
                <td>Date</td>
                <td>Name</td>
                <td>Sum</td>
                <td>Type</td>
            </tr>
                <?php
                    include ('list.php');
                ?>
        </table>
    </body>
</html>
